package com.inesv.api.baseclasses;

import java.math.BigDecimal;

/**
 * create by liukeling
 * class name BaseApi
 * 定义币种api常用的参数、构造方法
 *  所有数字类型均用16进制字符串
 *  查询的余额返回均转为最小单位
 */
public abstract class BaseApi {
    /**
     * 与最小单位换算的比率
     */
    protected BigDecimal WEI = BigDecimal.ONE;
    protected BaseRpcSend netRPCDefine;
    protected BigDecimal gas;
    protected BigDecimal gasPrice;
    protected String tokenAddress;
    protected String transMethodId;
    protected String balanceMethodId;

    /**
     * 基础的构造函数  传递了钱包服务器的相关信息
     * @param netRPCDefine  rpc连接方式
     */
    public BaseApi(BaseRpcSend netRPCDefine){
        this.netRPCDefine = netRPCDefine;
        initParam();
    }

    /**
     * 初始化一些参数
     */
    protected abstract void initParam();

    /************************获取相关参数和方式的方法*****************************/
    public BigDecimal getGas() {
        return gas;
    }

    public BigDecimal getGasPrice() {
        return gasPrice;
    }

    public BigDecimal getWEI() {
        return WEI;
    }

    public BaseRpcSend getNetRPCDefine() {
        return netRPCDefine;
    }

    public String getTokenAddress() {
        return tokenAddress;
    }

    public String getBalanceMethodId() {
        return balanceMethodId;
    }

    public String getTransMethodId() {
        return transMethodId;
    }

    public void setTokenAddress(String tokenAddress) {
        this.tokenAddress = tokenAddress;
    }

    public void setBalanceMethodId(String balanceMethodId) {
        this.balanceMethodId = balanceMethodId;
    }

    public void setGas(BigDecimal gas) {
        this.gas = gas;
    }

    public void setGasPrice(BigDecimal gasPrice) {
        this.gasPrice = gasPrice;
    }

    public void setTransMethodId(String transMethodId) {
        this.transMethodId = transMethodId;
    }

    public void setWEI(BigDecimal WEI) {
        this.WEI = WEI;
    }

    public void setNetRPCDefine(BaseRpcSend netRPCDefine) {
        this.netRPCDefine = netRPCDefine;
    }
}
